<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
        <meta name="author" content="order by dede58.com"/>
		<title>小米商城-个人中心</title>
		<link rel="stylesheet" type="text/css" href="/css/style.css">
		<!--bootstrap-->

		<!--&lt;!&ndash;引入axios框架&ndash;&gt;
		<script src="/js/axios.min.js"></script>
		&lt;!&ndash;引入Vue框架&ndash;&gt;
		<script src="/js/vue.js"></script>-->
	</head>

	<body>
	<!-- start header -->
		<header>
			<div class="top center">
				<div class="left fl">
					<ul>
						<li><a href="/views/index.html" target="_blank">小米商城</a></li>
						<li>|</li>
						<li><a href="">MIUI</a></li>
						<li>|</li>
						<li><a href="">米聊</a></li>
						<li>|</li>
						<li><a href="">游戏</a></li>
						<li>|</li>
						<li><a href="">多看阅读</a></li>
						<li>|</li>
						<li><a href="">云服务</a></li>
						<li>|</li>
						<li><a href="">金融</a></li>
						<li>|</li>
						<li><a href="">小米商城移动版</a></li>
						<li>|</li>
						<li><a href="">问题反馈</a></li>
						<li>|</li>
						<li><a href="">Select Region</a></li>
						<div class="clear"></div>
					</ul>
				</div>
				<div class="right fr">
					<div class="gouwuche fr"><a href="">我的订单</a></div>
					<div class="fr">
						<ul>
							<li><a href="/views/login.html" target="_blank" v-if="!userInfo.success">登录</a></li>
							<li v-if="!userInfo.success">|</li>
							<li><a href="/views/register.html" target="_blank" v-if="!userInfo.success">注册</a></li>
							<li v-if="userInfo.success"><a href="">{{userInfo.data.userName}}</a></li>
							<li v-if="userInfo.success">|</li>
							<li v-if="userInfo.success"><a href="/logout">退出</a></li>
							<li v-if="userInfo.success">|</li>
							<li v-if="userInfo.success"><a href="">消息通知</a></li>
							<li>|</li>
							<li><a href="/views/dingdanzhongxin.html">订单中心</a></li>
							<li>|</li>
							<li><a href="/views/self_info.html">个人中心</a></li>
						</ul>
					</div>
					<div class="clear"></div>
				</div>
				<div class="clear"></div>
			</div>
		</header>
	<!--end header -->
	<!-- start banner_x -->
		<div class="banner_x center">
			<a href="/views/index.html" target="_blank"><div class="logo fl"></div></a>
			<a href=""><div class="ad_top fl"></div></a>

			<div id="kind" class="nav fl">
				<ul>
					<li v-for="k in kind_arr"><a :href="'/shoppingsingle/ddCategorysInfo/' + k.id" target="_blank">{{k.categoryName}}</a></li>
				</ul>
			</div>

			<div class="search fr">
				<form action="" method="post">
					<div class="text fl">
						<input type="text" class="shuru"  placeholder="小米6&nbsp;小米MIX现货">
					</div>
					<div class="submit fl">
						<input type="submit" class="sousuo" value="搜索"/>
					</div>
					<div class="clear"></div>
				</form>
				<div class="clear"></div>
			</div>
		</div>
<!-- end banner_x -->
<!-- self_info -->
	<div class="grzxbj">
		<div class="selfinfo center">
		<div class="lfnav fl">
			<div class="ddzx">订单中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="" style="color:#ff6700;font-weight:bold;">我的订单</a></li>
					<li><a href="">意外保</a></li>
					<li><a href="">团购订单</a></li>
					<li><a href="">评价晒单</a></li>
				</ul>
			</div>
			<div class="ddzx">个人中心</div>
			<div class="subddzx">
				<ul>
					<li><a href="/views/self_info.html">我的个人中心</a></li>
					<li><a href="">消息通知</a></li>
					<li><a href="">优惠券</a></li>
					<li><a href="/views/address.html">收货地址</a></li>
				</ul>
			</div>
		</div>


			<div  class="col-md-12 column">
				<form id="myform" name="myform" method="post" action="address.html">
					<table>
						<tr>
							<td>ID：</td>
							<td><input  type="text" id="id" name="id" placeholder="请输入商品ID"
									 required /></td>
						</tr>
						<tr>
							<td>地址：</td>
							<td><input type="text" id="str" name="str" placeholder="请输入地址"
									   required /></td>
						</tr>
						<tr>
							<td>用户ID：</td>
							<td><input type="text" id="userid" name="userid" placeholder="请输入用户ID"
									   required /></td>
						</tr>
						<tr>
							<td colspan="2">
								<input type="button" value="提交"  onclick="doAddress()" ></input>
							</td>
						</tr>
						<tr>
							<td colspan="2"><input type="button" value="返回" onclick="history.back()"/></td>
						</tr>

					</table>

				</form>

			</div>

			<div class="clear"></div>
		</div>
	</div>
<!-- self_info -->
		
		<footer class="mt20 center">			
			<div class="mt20">小米商城|MIUI|米聊|多看书城|小米路由器|视频电话|小米天猫店|小米淘宝直营店|小米网盟|小米移动|隐私政策|Select Region</div>
			<div>©mi.com 京ICP证110507号 京ICP备10046444号 京公网安备11010802020134号 京网文[2014]0059-0009号</div> 
			<div>违法和不良信息举报电话：185-0130-1238，本网站所列数据，除特殊说明，所有数据均出自我司实验室测试</div>
		</footer>

	<!--引入vue框架-->
	<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
	<!--引入axios框架-->
	<script src="https://cdn.bootcdn.net/ajax/libs/axios/0.21.1/axios.min.js"></script>

	<script src="http://libs.baidu.com/jquery/2.0.0/jquery.min.js"></script>

	<script src="/js/common.js"></script>
	<script>




		/*   回显地址地址信息*/
		$( function () {
			//页面加载完毕，就加载要修改的数据并回显
			loadUpdateData();
		} )

		function loadUpdateData() {

			// 数据回显  location.search => ?9 , substring(1) =》 9
			let id = location.search.substring(1);
			if(!id) return;
			$.get('/selectAddressById/' + id, function (res) {
				if (res.success) {
					$('#id').val(res.data.id);
					$('#str').val(res.data.address);
					$('#userid').val(res.data.userId);
				} else {
					alert(res.msg);
				}
			})
		}


/*收货地址管理*/

		function doAddress() {
			//分装数据
			let data = {
				id : $("#id").val(),
				str : $("#str").val(),
				userId: $("#userid").val(),
			};
			$.ajax({
				type : "POST",
				url : "/updateAddress",
				data : JSON.stringify(data),
				contentType: 'application/json;charset=utf8',
				success: function (res) {
					if (res.success) {

						//跳转的地址
						location.href = '/views/address.html';
					} else {
						alert(res.msg);
					}
				}
			});
		}

	</script>

	</body>
</html>